package service.impl;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;

import dao.VipDao;
import dao.impl.VipDaoImpl;
import entiey.Vip;
import service.DictionaryService;
import service.VipService;

/**
 * 	会员业务层实现
 * 
 */
public class VipServiceImpl implements VipService{

	private VipDao vd = new VipDaoImpl();
	/**
	 * 	添加
	 */
	@Override
	public boolean saveVip(Vip t) {
		return vd.add(t)>0;
	}
	/**
	 * 修改
	 */
	@Override
	public boolean updateVip(Vip t) {
		return vd.update(t)>0;
	}
	/**
	 * 通过id删除
	 */
	@Override
	public boolean deleteVip(int card) {
		return vd.delete(card)>0;
	}
	/**
	 * 查询全部
	 */
	@Override
	public List<Vip> findVipAll() {
		return vd.findAll();
	}
	/**
	 * 通过id查询
	 */

	//通过名称模糊查询
	public List<Vip> query(String name) {
		return vd.findByName(name);
	}
	
	

	public Vip getVipById(int no) {
		// TODO Auto-generated method stub
		return vd.findById(no);
	}
	@Override

	public Vip findBycard(int card) {
		// TODO Auto-generated method stub
		return vd.findById(card);
	}
	@Override
	public Vip findById(int no) {
		// TODO Auto-generated method stub
		return vd.findById(no);
	}

	public Vip findByTel(String tel) {
		return vd.findByTel(tel).get(0);
	}

	
}
